<?php
 defined('RUN')or die('No access');class Route{private static $a=array();private static function load(){$b=CONFIGS_PATH.'routes'.EXT;if(is_readable($b)){self::$a=include($b);}}public static function parse($c){self::load();$d=$c;foreach(self::$a as $e=>$f){$d=self::get($e,$f,$c);if($d!=$c)break;}return $d;}private static function get($g,$h,$c){$i=array('[any]'=>'([A-Za-z0-9_-]{1,})','[num]'=>'([0-9]{1,})','[word]'=>'([A-Za-z_-]{1,})');$j=str_replace('/','\/',$g);foreach($i as $e=>$k){$j=str_replace($e,$k,$j);}$j='#^'.$j.'$#is';return preg_replace($j,$h,$c);}}